package router

import (
	ctrl "a-admin/web/controller"
	midd "a-admin/web/middleware"

	"github.com/gofiber/fiber/v2"
)

func InitSysRoleRoutes(r fiber.Router) {
	server := ctrl.NewSysRoleController()
	rg := r.Group("/system/role")
	{
		rg.Put("/authUser/selectAll", midd.PermsHandler("system:role:edit"), server.SelectAll)
		rg.Put("/authUser/cancel", midd.PermsHandler("system:role:edit"), server.Cancel)
		rg.Put("/authUser/cancelAll", midd.PermsHandler("system:role:edit"), server.CancelAll)

		rg.Get("/list", midd.PermsHandler("system:role:list"), server.List)
		rg.Get("/deptTree/:id", midd.PermsHandler("system:role:list"), server.DeptTree)
		rg.Get("/:id", server.Get)
		rg.Post("/export", server.Export)
		rg.Post("", server.Add)
		rg.Delete("/:ids", server.Del)
		rg.Put("", server.Edit)
		rg.Put("/changeStatus", server.ChangeStatus)
		rg.Put("/dataScope", server.DataScope)

		rg.Put("/editAndMenu", server.EditAndMenu)
		rg.Put("/editAndDept", server.EditAndDept)
	}
}
